package dao.jpa;

import java.util.List;

import vo.User;
import dao.UserDAO;

public class UserDAOJpaImpl extends GenericDaoJpaImpl<User, Long> implements UserDAO {

	public UserDAOJpaImpl() {
		super(User.class);
	}

	public List<User> findAll() {
		return super.executeFinder("User.findAll");
	}

	public List<User> findAll(int start, int pageSize) {
		return super.executeFinderPage("User.findAll", start, pageSize);
	}

	public long findTotalCount() {
		return super.executeFinderCount("User.findTotalCount");
	}

	public User findByUsernamePSW(String username, String psw) {
		return super.executeSingleFinder("User.findByUsernamePSW", username, psw);
	}

	public User getById(long id) {
		return super.read(id);
	}

	public User getByName(String name) {
		return super.executeSingleFinder("User.findByName", name);
	}


	public User getByLoginName(String name) {
		return super.executeSingleFinder("User.findByLoginName", name);
	}

	public void update(long id) {
		User user = super.read(id);
		super.update(user);
	}

	public void delete(long id)// 真正删除
	{
		User user = super.read(id);
		super.delete(user);
	}
}
